package com.hefei.garden.controller;

import com.hefei.garden.redis.BloomFilterConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author: devil
 * @Date: 2022/9/11 13
 * @Description:
 */
@RequestMapping("/redis")
@Controller
public class TestController {

    private static final String bloomFilterName = "isVipBloom";

    @Autowired
    private BloomFilterConfig bloomFilterConfig;

    @RequestMapping(value = "/add", method = RequestMethod.GET)
    @ResponseBody
    public void add(@RequestParam("value") int value) {
        bloomFilterConfig.bloomFilterAdd(bloomFilterName, value);
    }


    @RequestMapping(value = "/exists", method = RequestMethod.GET)
    @ResponseBody
    public void exists(@RequestParam("value") int value) {
        Boolean aBoolean = bloomFilterConfig.bloomFilterExists(bloomFilterName, value);
        System.out.println(aBoolean);
    }

}
